﻿/*
 * ============ [ 废土 ] ============
 *
 * [ 维护者 ]  argoran@gmail.com
 * [  状态  ]  原型
 *
 * ============ [ 注释 ] ============
 *
 * 客户端程序指令处理代码
 *
 * ==================================
 */

using System;

using LastLandClient.Core.CmdInterpreter;
using LastLandClient.Data;

using Up2Link.Client;
using Up2Link.SegString;
using Up2Link.Util;

namespace LastLandClient.Core
{
    public class CCommand
    {
        private ICommandInterpreter cmdInterp_;

        public void ExecuteCommand(String _cmd, String _args)
        {
            switch (_cmd)
            {
                case CConst.COMMAND_EXIT:
                    cmdInterp_ = new CCmdExit();
                    break;
                case CConst.COMMAND_START_CLIENT:
                    cmdInterp_ = new CCmdStartClient();
                    break;
                case CConst.COMMAND_CLOSE_CLIENT:
                    cmdInterp_ = new CCmdCloseClient();
                    break;
                case CConst.COMMAND_NEW_ACCOUNT:
                    cmdInterp_ = new CCmdNewAccount();
                    break;
                case CConst.COMMAND_CREATE_CHARACTER:
                    cmdInterp_ = new CCmdCreateCharacter();
                    break;
                case CConst.COMMAND_PLAY:
                    cmdInterp_ = new CCmdPlay();
                    break;
                case CConst.COMMAND_LOGIN:
                    cmdInterp_ = new CCmdLogin();
                    break;
                case CConst.COMMAND_LOGOUT:
                    cmdInterp_ = new CCmdLogout();
                    break;
                case CConst.COMMAND_MOVE:
                    cmdInterp_ = new CCmdMove();
                    break;
                case CConst.COMMAND_TALK:
                    cmdInterp_ = new CCmdTalk();
                    break;
                case CConst.COMMAND_COLLECT:
                    cmdInterp_ = new CCmdCollect();
                    break;
                case CConst.COMMAND_BUILD:
                    cmdInterp_ = new CCmdBuild();
                    break;
                case CConst.COMMAND_BUY:
                    cmdInterp_ = new CCmdBuy();
                    break;
                case CConst.COMMAND_ATTACK:
                    cmdInterp_ = new CCmdAttack();
                    break;
                case CConst.COMMAND_DEFEND:
                    cmdInterp_ = new CCmdDefend();
                    break;
                case CConst.COMMAND_RETREAT:
                    cmdInterp_ = new CCmdRetreat();
                    break;
                case CConst.COMMAND_INFO:
                    cmdInterp_ = new CCmdInfo();
                    break;
                default:
                    cmdInterp_ = new CCmdDefault();
                    break;
            }
            cmdInterp_.ExecuteCommand(_cmd, _args);
        }
    }
}
